<html><head><title>CreateRegularExpression</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<font face="Verdana, sans-serif" size="2"><p align="center"><b><font size="4">CreateRegularExpression()</font></b></p>
<p><b>Syntax</b></p><blockquote>
Result = <font color="#3A3966"><b>CreateRegularExpression</b></font>(#RegularExpression, Pattern$ [, Flags])</blockquote>

</blockquote>
<b>Description</b><br><blockquote>

Create a new regular expression using the specified pattern. 

</blockquote><p><b>Parameters</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>#RegularExpression</i></td>
<td width="90%"> 
A number to identify the new regular expression. 
<a href="../reference/purebasic_objects.html">#PB_Any</a> can be used to auto-generate this number. 

</td></tr>
<tr><td><i>Pattern$</i></td>
<td> 
The regular expression which will be applied to the string to match, extract or replace. 

</td></tr>
<tr><td><i>Flags (optional)</i></td>
<td> 
It can be a combination of the following values: 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_RegularExpression_DotAll</font>    : '.' matches anything including newlines.
  <font color="#924B72">#PB_RegularExpression_Extended</font>  : whitespace and '#' comments will be ignored.
  <font color="#924B72">#PB_RegularExpression_MultiLine</font> : '^' and '$' match newlines within data.
  <font color="#924B72">#PB_RegularExpression_AnyNewLine</font>: recognize 'CR', 'LF', and 'CRLF' as newline sequences.
  <font color="#924B72">#PB_RegularExpression_NoCase</font>    : comparison and matching will be case-insensitive
</font></pre>

</td></tr>
</table>
</blockquote><p><b>Return value</b></p><blockquote>

Returns nonzero if the regular expression was created successfully and zero if not. If <font color="#924B72">#PB_Any</font> was used 
for the #RegularExpression parameter then the generated number is returned on success. 
If an error has been detected in the pattern, the result will be zero. To get more 
information about the error, see <a href="regularexpressionerror.html">RegularExpressionError()</a>. 

</blockquote><p><b>Remarks</b></p><blockquote>

If a regular expression isn't used anymore, use <a href="freeregularexpression.html">FreeRegularExpression()</a> to free up some resources. 

</blockquote><p><b>Example</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2">  <font color="#3A3966">; This expression will match every word of 3 letter which begin by a lower case letter,</font>
  <font color="#3A3966">; followed with the character 'b' and which ends with an uppercase letter. ex: abC</font>
  <font color="#3A3966">;    </font>
  <b><font color="#3A3966">If</font></b> <font color="#3A3966">CreateRegularExpression</font>(0, &quot;[a-z]b[A-Z]&quot;)
    <b><font color="#3A3966">Debug</font></b> <font color="#3A3966">MatchRegularExpression</font>(0, &quot;abC&quot;) <font color="#3A3966">; Will print 1</font>
    <b><font color="#3A3966">Debug</font></b> <font color="#3A3966">MatchRegularExpression</font>(0, &quot;abc&quot;) <font color="#3A3966">; Will print 0</font>
  <b><font color="#3A3966">Else</font></b>
    <b><font color="#3A3966">Debug</font></b> <font color="#3A3966">RegularExpressionError</font>()
  <b><font color="#3A3966">EndIf</font></b>

</font></pre>

</blockquote><p><b>See Also</b></p><blockquote>

<a href="regularexpressionerror.html">RegularExpressionError()</a>, <a href="freeregularexpression.html">FreeRegularExpression()</a> 

</Blockquote><p><b>Supported OS </b><Blockquote>All</Blockquote></p><center><- <a href=countregularexpressiongroups.html>CountRegularExpressionGroups()</a> - <a href="index.html">RegularExpression Index</a> - <a href="examineregularexpression.html">ExamineRegularExpression()</a> -><br><br>

</body></html>